using System;
using System.Collections.Generic;
using System.Text;

namespace Caece.Libreria.FrontEnd
{
	class Util
	{
		public static byte[] StrToByteArray(string str)
		{
			string[] ByteStrings;
			ByteStrings = str.Split(".".ToCharArray());
			byte[] ByteOut;

			ByteOut = new byte[ByteStrings.Length];

			for (int i = 0; i < ByteStrings.Length; i++)
			{
				ByteOut[i] = Convert.ToByte(ByteStrings[i]);
			}

			return ByteOut;
		}

		public static string ByteArrayToStr(byte[] param)
		{
			string salida = String.Empty;
			for (int i = 0; i < param.Length; i++)
			{
				salida = salida + param[i].ToString() + ".";
			}

			salida = salida.Substring(0, salida.Length - 1);

			return salida;

			//System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
			//return encoding.GetString(param);
		}
	}

	
}
